﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace HML.Demo
{
    public partial class ImageSlideEffectForm : ItemFormTemplate
    {
        public ImageSlideEffectForm()
        {
            InitializeComponent();
        }

        #region 实现

        public override ItemFormTemplateViewObject AsynchRequestTask(ItemFormTemplateViewObject view)
        {
            System.Threading.Thread.Sleep(300);
            return view;
        }

        public override void DataBind(ItemFormTemplateViewObject viewObject)
        {
            if (this.ViewVisible)
            {
                this.Play();
            }
        }

        public override void ShowView()
        {
            base.ShowView();

            if (this.ViewStatus > ItemFormTemplateStatus.Create && this.ViewStatus < ItemFormTemplateStatus.Closed)
            {
                this.Play();
            }
        }

        public override void HideView()
        {
            base.HideView();

            this.Stop();
        }

        public override void CloseView()
        {
            base.CloseView();
        }

        #endregion

        #region 属性面板

        private void Play()
        {
            this.demo_imageSlide1.Index = 2;
            this.demo_imageSlide1.Play();
            this.demo_imageSlide2.Index = 5;
            this.demo_imageSlide2.Play();
            this.demo_imageSlide3.Index = 4;
            this.demo_imageSlide3.Play();
            this.demo_imageSlide4.Index = 7;
            this.demo_imageSlide4.Play();
            this.demo_imageSlide5.Index = 1;
            this.demo_imageSlide5.Play();
            this.demo_imageSlide6.Index = 3;
            this.demo_imageSlide6.Play();
            this.demo_imageSlide7.Index = 6;
            this.demo_imageSlide7.Play();
            this.demo_imageSlide8.Index = 8;
            this.demo_imageSlide8.Play();
            this.demo_imageSlide9.Index = 2;
            this.demo_imageSlide9.Play();
            this.demo_imageSlide10.Index = 9;
            this.demo_imageSlide10.Play();
        }

        private void Stop()
        {
            this.demo_imageSlide1.Stop();
            this.demo_imageSlide2.Stop();
            this.demo_imageSlide3.Stop();
            this.demo_imageSlide4.Stop();
            this.demo_imageSlide5.Stop();
            this.demo_imageSlide6.Stop();
            this.demo_imageSlide7.Stop();
            this.demo_imageSlide8.Stop();
            this.demo_imageSlide9.Stop();
            this.demo_imageSlide10.Stop();
        }

        #endregion
    }
}
